package net.csdn.business.notify.api.controller;



import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.csdn.business.notify.common.model.dto.NewNotifyBusinessDTO;
import net.csdn.business.notify.common.model.dto.UpdateNotifyBusinessDTO;
import net.csdn.business.notify.common.model.query.NotifyBusinessQuery;
import net.csdn.business.notify.common.model.vo.NotifyBusinessVO;
import net.csdn.business.notify.api.service.INotifyBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 通知中心-业务配置Controller
 * 
 * @author ruoyi
 * @date 2023-11-27
 */
@RestController
@RequestMapping("/api/v1/notify/business")
public class NotifyBusinessController
{
    @Autowired
    private INotifyBusinessService notifyBusinessService;

    /**
     * 分页查询通知中心-业务配置列表
     */
    @PostMapping("/list")
    public Page<NotifyBusinessVO> findPageList(@RequestBody NotifyBusinessQuery query)
    {
        return notifyBusinessService.findPageList(query);
    }


    /**
     * 根据id获取通知中心-业务配置详细信息
     */
    @GetMapping(value = "/{id}")
    public NotifyBusinessVO getInfo(@PathVariable("id") Long id)
    {
        return notifyBusinessService.selectNotifyBusinessById(id);
    }

    /**
     * 新增通知中心-业务配置
     */
    @PostMapping
    public Integer add(@RequestBody @Validated NewNotifyBusinessDTO notifyBusiness)
    {
        return notifyBusinessService.insertNotifyBusiness(notifyBusiness);
    }

    /**
     * 修改通知中心-业务配置
     */
    @PutMapping
    public Integer edit(@RequestBody @Validated UpdateNotifyBusinessDTO notifyBusiness)
    {
        return notifyBusinessService.updateNotifyBusiness(notifyBusiness);
    }

    /**
     * 删除通知中心-业务配置
     */
	@DeleteMapping("/{id}")
    public Integer remove(@PathVariable("id")  Long id)
    {
        return notifyBusinessService.deleteNotifyBusinessById(id);
    }
}
